package com.mystudio.android.calendar.model;

import android.text.format.Time;

/**
 * Stores the information about the first day of week
 */
public class Week {
	public static final int LAST_WEEK = 0;
	public static final int NEXT_WEEK = 1;
	
	public int julianDay;
	
	/**
	 * Month (0-11)
	 */
	public int month; 
	
	/**
	 * Day of month (1-31)
	 */
	public int day;

	/**
	 * Day of month in Lunar calendar
	 */
	public int lunarDay;
	
	public Week(int julianDay) {
		this.julianDay = julianDay;
		initFromJulianDay();
	}
	
	public Week(Week lastNextWeek, int type) {
		if (type == LAST_WEEK) {
			this.julianDay = lastNextWeek.julianDay + 7;
		} else {
			this.julianDay = lastNextWeek.julianDay - 7;
		}
		initFromJulianDay();
	}
	
	private void initFromJulianDay() {
		Time temp = new Time();
		temp.setJulianDay(julianDay);
		this.month = temp.month;
		this.day = temp.monthDay;
	}
}
